package org.aksw.xoperator.sparql;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * the representation of a sparql query. Contains the query itself as a string plus information what kind of sparql endpoints should be asked.
 * @author joerg
 *
 */
public class SparqlQuery {
	
	private List<SparqlEndpointIdentifier> agentsToAsk;
	
	private List<SparqlEndpointIdentifier> storesToAsk;
	
	private boolean askLocal = true;
	
	private Map<SparqlEndpointIdentifier, SparqlResult> results = new ConcurrentHashMap<SparqlEndpointIdentifier, SparqlResult>();
	
	private String queryString;
	
	public SparqlQuery(String queryString) {
		super();
		this.queryString = queryString;
	}

	public void addResult(SparqlResult result){
		results.put(result.getAnsweredBy(), result);
	}
	
	public String getQueryString() {
		return queryString;
	}

	public List<SparqlEndpointIdentifier> getStoresToAsk() {
		return storesToAsk;
	}

	public void setStoresToAsk(List<SparqlEndpointIdentifier> storesToAsk) {
		this.storesToAsk = storesToAsk;
	}

	public Map<SparqlEndpointIdentifier, SparqlResult> getResults() {
		return results;
	}

	public void setResults(Map<SparqlEndpointIdentifier, SparqlResult> results) {
		this.results = results;
	}

	public void setQueryString(String queryString) {
		this.queryString = queryString;
	}

	public List<SparqlEndpointIdentifier> getAgentsToAsk() {
		return agentsToAsk;
	}

	public void setAgentsToAsk(List<SparqlEndpointIdentifier> agentsToAsk) {
		this.agentsToAsk = agentsToAsk;
	}
	
	public void setAskLocal(boolean askLocal) {
		this.askLocal = askLocal;
	}

	public boolean isAskLocal() {
		return askLocal;
	}

}
